//
//  ILGLearningForCModule.m
//  ILGDemo
//
//  Created by happy on 2020/4/24.
//  Copyright © 2020 Happy. All rights reserved.
//

#import "ILGLearningForCModule.h"

@implementation ILGLearningForCModule

- (void)performTestMethod
{
//    funForLearningC();
    funForArray();
}

void funForArray()
{
    int sigleArray[10] = {0};
    
    for (int i = 0; i < 10; i++) {
        printf("sigleArray[%d] = %d", i, sigleArray[i]);
    }
    
    int array[3][4] = {{1,2,3},{4,5,6},{7,8,9}};
    printf("a[0][0] = %d", *array[1]);
}

void funForLearningC()
{
    static struct {
        int age;
        int array[2];
    } personObject __attribute__ ((used, section ("__DATA,__objc_const"))) = {
        2,
        3,
        4
    };
    
    typedef struct {
        int age;
        char *name;
    }Person;
    
    personObject.age = 6;
    
    Person person;
    Person *p;
    p = &person;
    p->age = 10;
    
    int i = 888;
    int *i_pointer = &i;
//    printf("firstNum = %p \n , i = %p", i_pointer, &i);
    
    int a = 11;
    int b = 22;
    int *a_pointer = &a;
    printf("a = %d \n", *(--a_pointer));
    
    char c = 'c';
    int array[] = {1,2,3,4,5};
    int size = sizeof(c);
    printf("size = %d \n", array);
}

@end
